// hyb_yl/mycenter/pages/extenExpert/extenExpert.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    myadd: [{}, {}, {}, {}],
    serch_text:'',
    doclist_serch:[],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var id = options.id
    that.setData({
      id: id
    })
    this.getalldoc()
  },
  bindinput(e){
    var that = this
    var doclist = that.data.doclist
    var arr = []
    for (var i = 0; i < doclist.length; i++) {
      if (doclist[i].username.indexOf(e.detail.value) != -1) {
        arr.push(doclist[i])
      }
    }
    that.setData({
      serch_text: e.detail.value,
      doclist_serch: arr
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  getalldoc() {
    var that = this
    var id = that.data.id
    app.util.request({
      'url': 'entry/wxapp/tuike.alldoc',
      data: {
        id: id
      },
      success: function (res) {
        console.log(res)
        that.setData({
          doclist: res.data
        })
      }
    })
  },
  teamindex(e) {
    var that = this
    var zid = e.currentTarget.dataset.zid
    console.log(e)
    wx.navigateTo({
      url: '/hyb_yl/czhuanjiasubpages/pages/zhuanjiazhuye/zhuanjiazhuye?zid=' + zid,
    })
  }
})